package com.eascs.workflow.sys.dao;

import java.util.List;

import com.eascs.app.dao.PageResult;
import com.eascs.workflow.common.entity.sys.ActOrgDetail;
import com.eascs.workflow.common.entity.sys.ActOrgEntity;
import com.eascs.workflow.common.entity.sys.ActOrgUser;

public interface SysOrgDao {
	public List<ActOrgEntity> getOrgListByLevel(String parentId, int level);

	public List<ActOrgEntity> getOrgProvince();

	public List<ActOrgEntity> getOrgProvinceAndHQ();

	public List<Object[]> getOrgListLikeName(String orgName, int level);

	public List<Object[]> getOrgListLikeNameWithLevels(String orgName, List<Integer> levelList);

	public List<Object[]> getOrgAllLikeName(String orgName);

	public List<ActOrgEntity> getOrgAllList();

	public List<ActOrgEntity> getAllPlatformList();

	public ActOrgEntity getOrgByIds(String ids);

	public ActOrgEntity getOrgByName(String name);

	public List<ActOrgEntity> getOrgByParentIds(List<String> parentIds);

	public ActOrgEntity getOrgUnitNo(String unitNo);

	public int insert(ActOrgEntity orgEntity);

	public int update(ActOrgEntity orgEntity);

	public int delete(String ids);

	public String getUnitsNoByUnitsCode(String unitsCode);

	public ActOrgDetail getOrgDetailByUnitCode(String unitCode);

	public ActOrgDetail getOrgDetailByUnitNo(String unitNo);

	/**
	 * 递归查询指定parentId下面所有指定level的组织
	 * 
	 * @param parentId
	 * @param preList
	 *            用于递归时记录上一levl的同级组织
	 * @param level
	 * @return
	 */
	public List<ActOrgEntity> getAllOrgListByParentIdAndLevel(String parentId, List<ActOrgEntity> preList, int level);

	public PageResult<ActOrgUser> queryPageActOrgUser(List<String> orgIds, int pageSize, int pageIndex);

	public int insertActOrgUser(ActOrgUser actOrgUser);

	public int deleteActOrgUser(String id);

	public ActOrgUser getOrgUserByUserNo(String userNo);

	public ActOrgEntity getActOrgByUserNo(String userNo);

	public List<ActOrgEntity> getAllOrgParentList(String orgId, List<ActOrgEntity> parentLisst);

	/**
	 * 联想搜索组织机构人员/经办人
	 * 
	 * @param userName
	 * @return
	 */
	public List<Object[]> getOperatorList(String userName);

	public List<Object[]> getOperatorListByRoleCode(String userName, String roleCode);

	/**
	 * 关联用户和角色查询用户所属组织机构（act_org_role_user和act_org_user）
	 * 
	 * @param userNo
	 * @return
	 */
	public List<ActOrgEntity> getOrgListByRoleAndUser(String userNo);

	public List<ActOrgEntity> getOrgListByUserNo(String userNo);

	/**
	 * 获取所有的叶子节点，总部返回NULL
	 * 
	 * @param orgId
	 * @return
	 */
	public List<ActOrgEntity> getLeafNodeByParentId(String orgId);

	public List<ActOrgEntity> getOrgChildrenByOrgId(String orgId);

	/**
	 * 通过平台unito查找对应省区
	 */
	public ActOrgEntity getProvincialByOrgUnito(String unito);

	/**
	 * 获取该节点下的省份
	 * 
	 * @param nodeId
	 * @return
	 */
	public List<ActOrgEntity> getChildProvinceByNodeId(String nodeId);

	/**
	 * 获取该节点上的省份
	 * 
	 * @param nodeId
	 * @return
	 */
	public ActOrgEntity getParentProviceByNodeId(String nodeId);

	/**
	 * 
	 * @param parentId
	 * @param level
	 * @return
	 */
	public List<ActOrgEntity> getOrgByParentIdAndLevel(String parentId, int level);

	public String getProvinceLetterCode(String provinceCode);
}
